It's very easy to generate the whole anonymous implementation of some interface, for example, of some listener,
by using SmartType code completion.
For example, you may type
Component component;
component.addMouseListener(
new <caret is here>
);
and press Ctrl-Shift-Space to see what will happen.